<template>
  <div>
    <p v-for="i in 5" :key="i" :ref="refs.set">{{ i }}</p>
  </div>
</template>

<script setup>
import { onMounted, ref } from 'vue';

const refs = ref([]);
refs.value.set = el => {
  refs.value.push(el);
};

onMounted(() => {
  console.log(refs.value);
});

// https://vueuse.org/core/useTemplateRefsList/#usage
// useTemplateRefsList 的实现
</script>
